// 上月项目绩效平均分
blockPropState['vid_ncw2k5bigj_props'].dataSets.formatData[0].value
// 上月员工绩效平均分数
vid_6yryuhkyo4
// 上月员工公式平均分数
vid_tlvv4qmv0i
// 格式化数据
let originalData = [
    {
        "project_name": "一体机",
        "项目绩效分数": 50
    },
    {
        "project_name": "水泥智能配料产品化",
        "项目绩效分数": 66
    }
];

// 格式化xAxisData
let xAxisData = originalData.map(item => {
    return {
        "value": item.project_name,
        "values": [item.project_name]
    };
});

// 格式化seriesData
let seriesData = originalData.map(item => {
    return {
        "dataFormatType": "yAxis",
        "name": "项目绩效分数",
        "data": [{
            "value": item["项目绩效分数"]
        }]
    };
});

// 各项目上月绩效分数排行
setTimeout(() => {
    blockPropState['vid_evqltj9ykb_props']['dataSets'].xAxisData = [{
        "value": "一体机",
        "values": [
            "一体机"
        ]
    }]
    blockPropState['vid_evqltj9ykb_props']['dataSets'].seriesData = [
        {
            "dataFormatType": "yAxis",
            "name": "项目绩效分数",
            data: [{
                "value": 50
            },]
        }
    ]
    console.log(blockPropState['vid_evqltj9ykb_props']['dataSets'], '第一柱状图')
}, 3000)
// 各项目上月关联任务完成率排行

setTimeout(() => {
    blockPropState['vid_u1d2jy9o11_props']['dataSets'].xAxisData = [{
        "value": "一体机",
        "values": [
            "一体机"
        ]
    }]
    blockPropState['vid_u1d2jy9o11_props']['dataSets'].seriesData = [
        {
            "dataFormatType": "yAxis",
            "name": "项目绩效分数",
            data: [{
                "value": 50
            },]
        }
    ]
    console.log(blockPropState['vid_u1d2jy9o11_props']['dataSets'], '第一柱状图')
}, 3000)


// 交付for循环
blockPropState['vid_rk806jurtu_props']['dataSets']['source']
// 平台for循环
blockPropState['vid_59o5dpyii8_props']['dataSets']['source']
// 市场for循环
blockPropState['vid_nplhhqvz61_props']['dataSets']['source']


// 备份
setTimeout(()=>{
    post('/solution-ppm/api/v2/built-in-system-ppm/dashboard/performance/project_info/search').then(({ data }) => {
        let deliverList = [];
        let marketList = [];
        let productList = [];
        data.forEach(project => {
            if (project.projectType === '交付') {
                deliverList.push(project);
            } else if (project.projectType === '市场') {
                marketList.push(project);
            } else if (project.projectType === '产品研发') {
                productList.push(project);
            }
        });
          deliverList = deliverList.map(item => convertCamelToUnderscore(item));
        marketList = marketList.map(item => convertCamelToUnderscore(item));
        productList = productList.map(item => convertCamelToUnderscore(item));
    // 交付for循环
    blockPropState['vid_rk806jurtu_props']['dataSets']['source'] = deliverList
    // 平台for循环
    blockPropState['vid_59o5dpyii8_props']['dataSets']['source'] = productList
    // 市场for循环
    blockPropState['vid_nplhhqvz61_props']['dataSets']['source'] = marketList
      
      console.log(deliverList,'交付')
        console.log(productList,'产品')
        console.log(marketList,'市场')
    })
    
    },500)
    function convertCamelToUnderscore(obj) {
        const result = {};
        for (const key in obj) {
            if (obj.hasOwnProperty(key)) {
                const newKey = key.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
                result[newKey] = obj[key];
            }
        }
        return result;
    }